package com.ruoyi.nav.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.nav.api.RemoteNavService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 用户服务降级处理
 * 
 * @author ruoyi
 */@Component
public class RemoteNavFallbackFactory implements FallbackFactory<RemoteNavService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteNavFallbackFactory.class);

    @Override
    public RemoteNavService create(Throwable throwable)
    {
        log.error("导航服务调用失败:{}", throwable.getMessage());
        return new RemoteNavService()
        {

            @Override
            public R<String> hello() {
                return R.fail("获取导航信息失败:" + throwable.getMessage());
            }
        };
    }
}
